package com.alex.utils.html;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public abstract class HtmlUtils {
	
	private static final String VOID_TAGS = "area, base, br, col, hr, img, input, link, meta, param, command, keygen, source";

	private static final String BLOCK_TAGS = "address, blockquote, div, dl, fieldset, form, h1, h2, h3, h4, h5, h6, hr, noscript, ol, p, pre, table, ul, dd, dt, li, tbody, td, tfoot, th, thead, tr, button, del, ins, map, object, script";

	private static final Set<String> VOID_TAGS_SET = new HashSet<String>(Arrays.asList(VOID_TAGS.split(", ")));

	private static final Set<String> BLOCK_TAG_SET = new HashSet<String>(Arrays.asList(BLOCK_TAGS.split(", ")));
	
	public static boolean isVoidTag(String tag) {
		return VOID_TAGS_SET.contains(tag);
	}

	public static boolean isBlockTag(String tag) {
		return BLOCK_TAG_SET.contains(tag);
	}
}
